package com.hongmeng.teamwork.config.ddl;

import com.baomidou.mybatisplus.extension.ddl.IDdl;
import com.google.common.collect.Lists;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.sql.DataSource;
import java.util.List;
import java.util.function.Consumer;

@Component
public class MySqlDdl implements IDdl {

    @Resource
    private DataSource dataSource;

    @Override
    public void runScript(Consumer<DataSource> consumer) {
        consumer.accept(dataSource);
    }

    @Override
    public List<String> getSqlFiles() {
        return Lists.newArrayList(
                "db/2023-11/11-18-create-task-user-direct-table.sql",
                "db/2023-11/11-17-create-project-group-rel-table.sql",
                "db/2023-11/11-16-create-task-user-rel-table.sql",
                "db/2023-11/11-16-create-task-table.sql",
                "db/2023-11/11-15-create-project-table.sql"
        );
    }
}
